Skip to content

Disabling "orphaned" models when provider disabled#248

Open
jfcsantos wants to merge 11 commits intomainfrom
jsantos/provider-manager-improvements
Open

Disabling "orphaned" models when provider disabled#248
jfcsantos wants to merge 11 commits intomainfrom
jsantos/provider-manager-improvements

Conversation

@jfcsantos
Copy link
Contributor

Overview

This PR enhances the provider and model management page with better UX for handling provider-model relationships. It introduces confirmation dialogs when disabling providers would orphan models, and prevents users from enabling models that have no enabled providers.

Key Changes

  1. New Confirmation Dialog for Disabling Providers
    When a user attempts to disable a provider that is the sole provider for one or more selected models, a confirmation dialog is now displayed showing:
  • The provider being disabled
  • A list of models that will be automatically deselected (with both display name and model ID)
  • Clear confirm/cancel actions
  1. Model Enable flow
    When a user tries to enable a model that has no enabled providers:
  • Instead of the checkbox doing nothing, the model details dialog opens
  • This guides users to first enable a provider that supports the model
Screenshot 2026-02-16 at 13 52 31 Screenshot 2026-02-16 at 13 52 42 Screenshot 2026-02-16 at 13 54 18

When a provider is deselected on the Providers tab, models that would
have zero enabled providers are now automatically removed from the
selection. A confirmation dialog is shown to the user listing which
models will be affected before proceeding.

Changes:
- Add computeModelsOnlyFromProvider() helper to identify orphaned models
- Update toggleProviderEnabled() to remove orphaned models
- Add DisableProviderConfirmDialog component
- Update OrganizationProvidersAndModelsPage to show confirmation
- Add comprehensive unit tests
Add logic to prevent enabling models when all their providers are disabled. When attempting to enable a model without any enabled providers, the model details dialog is opened instead.
@kiloconnect
Copy link
Contributor

kiloconnect bot commented Feb 16, 2026

Code Review Summary

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 1

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
src/components/organizations/providers-and-models/allowLists.domain.ts 192 computeModelsOnlyFromProvider() returns [] when draftModelAllowList is empty ("allow all"), so disabling a provider may not surface orphaned models
src/components/organizations/providers-and-models/allowLists.domain.ts N/A computeModelsOnlyFromProvider() skips wildcards (existing inline comment)
src/components/organizations/providers-and-models/OrganizationProvidersAndModelsPage.tsx 238 Enabling a model with no providers may silently fail when provider index is missing the model (existing inline comment)

SUGGESTION

File Line Issue
src/components/organizations/providers-and-models/OrganizationProvidersAndModelsPage.tsx 203 Display name source likely wrong (name vs expected field) (existing inline comment)
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (6 files)

@jfcsantos jfcsantos requested a review from iscekic February 16, 2026 21:21

// Collect all model IDs to check, expanding wildcards to concrete models
const modelIdsToCheck = new Set<string>();
for (const entry of draftModelAllowList) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: computeModelsOnlyFromProvider() returns [] when draftModelAllowList is empty ("allow all")

When draftModelAllowList.length === 0, modelIdsToCheck stays empty, so disabling a provider in "allow all models" mode will never surface orphaned models (and the confirm dialog won"t appear). If the intent is to warn/remove models that become unavailable, consider treating an empty allow list as "check all current models" (e.g., iterate modelProvidersIndex keys) before computing orphans.

// If trying to enable a model, check if it has any enabled providers
if (nextAllowed) {
const providersForModel = selectors.modelProvidersIndex.get(modelId);
if (providersForModel) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Enabling a model with no providers may silently fail

providersForModel is only checked when truthy. If selectors.modelProvidersIndex.get(modelId) returns undefined (model missing from the index), enabling proceeds via actions.toggleModel, but later computeAllowedModelIds(..., enabledProviderSlugs) will currently drop models with unknown providers. Consider treating a missing index entry as "no enabled providers" (open details / block enable) to avoid a confusing toggle that doesn"t stick.


const orphanedModels: string[] = [];

// Collect all model IDs to check, expanding wildcards to concrete models
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: draftModelAllowList = [] ("all models allowed") yields no orphan detection

computeModelsOnlyFromProvider() only iterates draftModelAllowList, so when the list is empty it returns [] and the UI won’t warn that disabling a provider will implicitly disable models that are only served by that provider. Consider treating an empty allow list as "all currently-known models" (e.g. seed modelIdsToCheck from modelProvidersIndex.keys()) so the confirmation dialog is still shown when appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant